import 'package:flutter/material.dart';

main() {
  runApp(
    MaterialApp(
      home: SwapPage(),
    ),
  );
}

class SwapPage extends StatefulWidget {
  @override
  _SwapPageState createState() => _SwapPageState();
}

class _SwapPageState extends State<SwapPage>
    with SingleTickerProviderStateMixin {
  AnimationController _controller;
  @override
  initState() {
    super.initState();
    _controller = new AnimationController(
        duration: Duration(milliseconds: 60000), vsync: this);
    Future.delayed(Duration.zero, () {
      _controller.repeat();
    });
  }

  @override
  void dispose() {
    super.dispose();
    _controller.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("雷达扫描"),
      ),
      body: Center(
        child: Stack(
          children: [
            ClipOval(
              child: Container(
                width: 200,
                height: 200,
                decoration: BoxDecoration(
                  color: Colors.green,
                ),
              ),
            ),
            buildRotationTransition(),
          ],
        ),
      ),
    );
  }

  RotationTransition buildRotationTransition() {
    return RotationTransition(
      turns: _controller,
      child: ClipOval(
        child: Container(
          width: 200,
          height: 200,
          decoration: BoxDecoration(
            gradient: SweepGradient(
              colors: [
                Colors.white.withOpacity(0.2),
                Colors.white.withOpacity(0.6),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
